/*
-----------------------------------------------------------------------------
This source file is part of DIVA
The project of Engineering Lab, dept. of CSIE, NTNU.

Copyright (c) 2000-2006 The Software Engineering Lab, dept. of CSIE, NTNU.
-----------------------------------------------------------------------------
Filename:    ubvm_cube.h
Description: This file is a vm that show boolean value in shape of ball.
-----------------------------------------------------------------------------
*/
/*------------------------------------------------------------*/
#ifndef _ubvm_line_H_
#define	_ubvm_line_H_
/*------------------------------------------------------------*/

#include "DIVA_VM.h"
#include "MovableText.h"
#include <string>
#include "xParameterPack.h"
#include "Line3D.h"

//using namespace Ogre;

class ubvm_line: public DIVA_VM{

protected:
	Ogre::Vector3 start;
	Ogre::Vector3 end;
	float* _sx;
	float* _sy;
	float* _sz;
	float* _ex;
	float*_ey;
	float*_ez ;
	DIVA_VM* _startVM;
	DIVA_VM* _endVM;
	Ogre::SceneNode* _line_node;
	Line3D* _myLine;
	Ogre::Real computeCenter( float start, float end );

public:
	/// constructor & destructor
	ubvm_line(xParameterPack xpp);
	~ubvm_line();

	/// draw - for animation or not.
	//void draw();
	std::string getVMType() { return std::string("line"); }

	// the overriden method of DIVA_VM
	void load_3Dresources();
	void reg_event_entity();
	void set_default_values();
	void init_private_attrs_started() { }  // no more private attributes
	void init_private_attrs_ended() { }
	void init_color_and_transparency();
	void VMValueUpdated();
	/// basic method that each vm has
	void VMPicked(Ogre::Real x,Ogre::Real y,Ogre::Real z);
	void VMSelected(Ogre::Real x,Ogre::Real y,Ogre::Real z){}
	//void VMDragged(Ogre::Real x,Ogre::Real y,Ogre::Real z);
	void VMAnimation(const Ogre::FrameEvent &);
	// the overridden method of OgreVM
	void setBodyScale(Ogre::Vector3);
	void setColorTo3DLine();
	Ogre::Vector3 getOriginalBodySize(){return Ogre::Vector3(1,1,1);}
	Ogre::Vector3 getActualSize(){return Ogre::Vector3(1,1,1);}
	bool isBodyScaleWrtSceneNode();
	Ogre::Vector3 getBodyScale(){return Ogre::Vector3(1,1,1);}

	// 暫時的function - 將integer轉成string
	std::string intToString(int its){
		std::stringstream ss;
		std::string str;

		ss << its;
		str = ss.str();
		ss.str("");

		return str;
	}

};
/*------------------------------------------------------------*/
#endif	//#ifndef _ubvm_cube_H_
/*------------------------------------------------------------*/